package com.jml.蚂蚁.netty.对象序列化client.MsgpackPack编码解码;


import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;
import org.msgpack.MessagePack;

/**
 * @author:jml
 * @date: 2019/12/25 11:01
 * @description：MessagePack编码器
 */
public class MsgpackEncoder extends MessageToByteEncoder {
	
	@Override
	protected void encode(ChannelHandlerContext ctx, Object msg, ByteBuf byteBuf) throws Exception {
		MessagePack msgpack = new MessagePack();
		byteBuf.writeBytes(msgpack.write(msg));
		
	}
}
